import { SET_TODO,SET_TODO_LIST,REMOVE_TODO,SET_STATUS, SET_DOING } from "./actionsType";
import { ITodo, IState } from '@/typeings';
import { Commit } from "vuex";

interface ICtx {
    commit : Commit ,
    state ?: IState ,
}

export default {
    
    [SET_TODO] ( { commit , state } : ICtx , todo : ITodo ) : void {
        commit(SET_TODO,todo)
    },

    [SET_TODO_LIST] ( { commit , state } : ICtx , todoList : ITodo[] ) : void {
        commit(SET_TODO_LIST, todoList)
    },

    [REMOVE_TODO] ( { commit , state } : ICtx , id : number ) : void {
        commit(REMOVE_TODO, id)
    },

    [SET_STATUS] ( { commit , state } : ICtx , id : number ) : void {
        commit(SET_STATUS, id)
    },
    [SET_DOING] ( { commit , state } : ICtx , id : number ) : void {
        commit(SET_DOING, id)
    },
}